package com.tong.cloud.redisson.idempotent;

import com.tong.cloud.redisson.idempotent.annotation.Idempotent;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DemoController {
    @GetMapping("/get")
    @Idempotent(key = "#key", expireTime = 3, message = "请勿重复请求")
    public String get(String key) throws Exception {
        Thread.sleep(2000L);
        return "success";
    }

    @GetMapping("/nokey")
    @Idempotent(expireTime = 3, message = "请勿重复请求")
    public String nokey() throws Exception {
        Thread.sleep(2000L);
        return "success";
    }


}

